package com.desetalk.client.cmd.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

import com.desetalk.client.cmd.Command;
import com.desetalk.proto.RequestProtocol.Request;
import com.desetalk.proto.RequestProtocol.Request.Builder;

public class EnterLobbyCommand extends Command {

	@Override
	public boolean checkInput(String input) {
		return input.split(" ").length == 2;
	}

	@Override
	public List<Object> getParam(String input) {
		List<Object> result = new ArrayList<Object>();
		
		Scanner sc = new Scanner(input);
		sc.next();
		
		result.add(sc.nextInt());
		
		return result;
	}

	@Override
	public Builder process(List<Object> param) {
		Builder builder = Request.newBuilder();
		builder.setEnterLobby(Integer.parseInt(param.get(0).toString()));
		return builder;
	}

	@Override
	public boolean printHelp() {
		System.out.println("enterLobby userId");
		return true;
	}
}
